/*
 * lib2Desa - Another 2D game library in C++
 * Copyright (C) 2009 Erivaldo Xavier de Lima Filho
 *
 * This program is free software and is distributed under GNU General Public License version 3. You can modify and/or redistribute
 * it under the terms of GPL version 3 or posterior version. This program comes with NO WARRANTY, for more details, see LICENSE,
 * or <http://www.gnu.org/licenses>.
 *
 * Contact info:
 *
 *	Erivaldo Xavier de Lima Filho, desadoc@gmail.com
 *
 */

#include "Core/SpriteSequence.hpp"

#include <iostream>
using namespace std;

#ifndef _NO_NAMESPACE
namespace lib2Desa {
#endif

SpriteSequence::SpriteSequence(u16 sz)
: size(sz)
{
	sprites.resize(sz);

	u16 i;
	for(i=0;i<size;i++)
	{
		sprites[i] = null;
	}
}

SpriteSequence::~SpriteSequence(void)
{

}

u16 SpriteSequence::getSize(void) const
{
	return size;
}

const shared_ptr<ISprite> SpriteSequence::operator[](u16 pos) const
{
	if(pos < size)
		return sprites[pos];
	else return shared_ptr<ISprite>();
}

shared_ptr<ISprite> SpriteSequence::operator[](u16 pos)
{
	if(pos < size)
		return sprites[pos];
	else return shared_ptr<ISprite>();
}

shared_ptr<ISprite> SpriteSequence::set(shared_ptr<ISprite> s, u16 pos)
{
	shared_ptr<ISprite> old = sprites[pos];
	sprites[pos] = s;
	return old;
}

#ifndef _NO_NAMESPACE
}
#endif
